/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades.divisiones;

import entidades.Permisos;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;

/**
 *
 * @author fcarou
 */
@Entity
@Table (name = "DIVISIONES")
@Inheritance (strategy = InheritanceType.TABLE_PER_CLASS)
public class Division implements Serializable
{
    @Id
    @Column (name = "ID_DIVISION")
    @GeneratedValue (strategy = GenerationType.IDENTITY)
    private long id;
    
    @Column (name = "NOMBRE")
    private String nombre;
    
    @Column (name = "CODIGO")
    private String codigo;
    
    @JoinColumn (name = "PERMISOS")
    @ManyToOne (cascade = {CascadeType.REFRESH})
    private Permisos permisos;
    
    @Version
    private Timestamp version;
    
    public Division ()
    {
        
    }
    
    public Division (String nombre, String codigo, Permisos permisos)
    {
        this.nombre = nombre;
        this.codigo = codigo;
        this.permisos = permisos;
    }

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getNombre()
    {
        return nombre;
    }

    public void setNombre(String nombre)
    {
        this.nombre = nombre;
    }

    public String getCodigo()
    {
        return codigo;
    }

    public void setCodigo(String codigo)
    {
        this.codigo = codigo;
    }

    public Permisos getPermisos()
    {
        return permisos;
    }

    public void setPermisos(Permisos permisos)
    {
        this.permisos = permisos;
    }
}
